package com.lwq.logtrace.tookit;

import com.alibaba.ttl.TransmittableThreadLocal;

/**
 * @author 刘文强
 * 日志链路持有者
 */
public class LogTraceContextHolder {

    private static final TransmittableThreadLocal<String> LOG_TRACE = new TransmittableThreadLocal<>();


    /**
     * 设置日志链路信息
     * @param traceId
     */
    public static void set(String traceId){
        LOG_TRACE.set(traceId);
    }


    /**
     * 获取日志链路
     *
     * @return
     */
    public static String get(){
        return LOG_TRACE.get();
    }


    /**
     * 清空日志链路
     */
    public static void remove(){
        LOG_TRACE.remove();
    }




}
